
#include <sys/cdefs.h>

#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <assert.h>
#include <string.h>
#else
#include <lib/libkern/libkern.h>
#endif 

#undef memcmp
/*
 * Compare memory regions.
 */
int
memcmp(const void *s1, const void *s2, size_t n)
{
	_DIAGASSERT(s1 != 0);
	_DIAGASSERT(s2 != 0);

	if (n != 0) {
		const unsigned char *p1 = s1, *p2 = s2;

		do {
			if (*p1++ != *p2++)
				return (*--p1 - *--p2);
		} while (--n != 0);
	}
	return (0);
}

#if defined(__ARM_EABI__)
__strong_alias(__aeabi_memcmp, memcmp)
#endif
